<template>
  <div class="container">
    <menu-item></menu-item>
    <div class="content-wrap">
      <div class="header">
        <!-- <div class="rectangle">
          <span
            @click="handleBtn(1)"
            :class="{ actived: route.path == '/commend' }"
            class="left"
            >表扬台</span
          >
          <span
            @click="handleBtn(2)"
            :class="{ actived: route.path == '/publicity' }"
            class="right"
            >cxgs</span
          >
        </div> -->
        <div class="btn-box">
          <div class="btn-left" @click="handleBtn(1)">
            交易查询<span v-if="route.path == '/suyuaninquire'"></span>
          </div>
          <div class="btn-right" @click="handleBtn(2)">
            溯源查询<span v-if="route.path == '/tradinquire'"></span>
          </div>
        </div>
      </div>
      <div class="content">
        <router-view v-slot="{ Component }">
          <keep-alive>
            <component
              :is="Component"
              :key="$route.name"
              v-if="$route.meta.keepAlive"
            />
          </keep-alive>
          <component
            :is="Component"
            :key="$route.name"
            v-if="!$route.meta.keepAlive"
          />
        </router-view>
      </div>
    </div>
  </div>
</template>

<script setup>
import menuItem from "@/components/common/menuItem.vue";
import { ref } from "vue";
import { useRoute, useRouter } from "vue-router";
const route = useRoute();
const router = useRouter();
const type = ref(1);
const handleBtn = (e) => {
  if (e == 1) {
    router.push("/tradinquire");
  } else {
    router.push("/suyuaninquire");
  }
};
</script>

<style lang="scss" scoped>
.container {
  height: 100%;
  .content-wrap {
    height: 460px;
    display: flex;
    flex-direction: column;
    .header {
      width: 100%;
      display: flex;
      justify-content: center;
      .btn {
        color: #fff;
        width: 100%;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        height: 35px;
        font-size: 14px;
        letter-spacing: 1px;
        img {
          height: 100%;
          margin-right: 6px;
        }
      }
      .rectangle {
        display: flex;
        justify-content: center;
        color: #103b97;
        font-weight: 600;
        font-size: 18px;
        .left {
          text-align: center;
          width: 100px;
          padding: 7px 10px;
          background: linear-gradient(to left, #d5dced, #fff);
          border-top-left-radius: 20px;
          border-bottom-left-radius: 20px;
        }
        .right {
          text-align: center;
          width: 100px;
          padding: 8px 10px;
          background: linear-gradient(to right, #d5dced, #fff);
          border-top-right-radius: 20px;
          border-bottom-right-radius: 20px;
        }
        .actived {
          background: #fff;
        }
      }
    }
    .content {
      height: 415px;
    }
  }
}

.btn-box {
  width: 230px;
  height: 40px;
  border-radius: 20px;
  background-color: #fff;
  display: flex;
  position: relative;
  overflow: hidden;
  .btn-left {
    font-size: 16px;
    font-weight: bold;
    color: #1d3a91;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    span {
      display: inline-block;
      position: absolute;
      top: 0;
      right: 0;
      width: 100%;
      height: 100%;
      background-image: linear-gradient(to right, #ffffff, #1d3a91);
      opacity: 0.2;
      transform: skewX(-35deg);
    }
  }
  .btn-right {
    font-size: 16px;
    font-weight: bold;
    color: #1d3a91;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    span {
      display: inline-block;
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-image: linear-gradient(to right, #1d3a91, #ffffff);
      opacity: 0.2;
      transform: skewX(35deg);
    }
  }
}
</style>
